package com.dayaokeji.rhythmschoolstudent.client.home.meeting;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.FrameLayout;

import com.dayaokeji.rhythmschoolstudent.R;
import com.dayaokeji.rhythmschoolstudent.client.common.base.common.BaseActivity;
import com.dayaokeji.rhythmschoolstudent.client.home.join.JoinMeetingAndCourseActivity;
import com.dayaokeji.rhythmschoolstudent.client.mine.MeetingSearchActivity;

import butterknife.BindView;

/**
 * 会议
 */
public class MeetingActivity extends BaseActivity {

    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.container)
    FrameLayout container;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_meeting);
        setSupportActionBar(toolbar);
        inflaterMeetingListFragment();
    }

    private void inflaterMeetingListFragment() {
        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.container, MeetingListFragment.newInstance());
        fragmentTransaction.commit();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.meeting_list, menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.menu_add_meeting:
                JoinMeetingAndCourseActivity.Companion.navigation(this, JoinMeetingAndCourseActivity.SearchType.MEETING);
                break;
            case R.id.menu_search_meeting:
                MeetingSearchActivity.navigation(this);
                break;

        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
